﻿#include "IsoVortex.h"
#include "worklet/ComputeResidual.h"
#include "worklet/InitialCondition.h"
#include "worklet/MeshModifier.h"


RegisterObject(IsoVortex);
IsoVortex::IsoVortex(const Configuration& cfg)
  : EulerEquation(cfg)
  , _finite_volume(Get<bool>("fv", false))
{
}

void IsoVortex::InitialCondition()
{
  _timer.Start();
  Loops::InitialConditionIsoVortex(*this);
  Success("IsoVortex::InitialCondition初始条件设置完成", _timer.GetElapsedTime(), "s");
}

void IsoVortex::UpdateResidual()
{
  _timer.Start();
  if (_finite_volume)
  {
    Loops::ComputeResidualIsoVortexOnUnstructuredMesh(*this);
    Info("IsoVortex::有限体积，", "时间: ", _timer.GetElapsedTime(), " s");
  }
  else
  {
    Loops::ComputeResidualIsoVortex(*this);
    Info("IsoVortex::有限差分，", "时间: ", _timer.GetElapsedTime(), " s");
  }
}
